package com.dwd.hrm.client;

import com.dwd.hrm.doc.CourseDoc;
import com.dwd.hrm.query.CourseDocQuery;
import com.dwd.hrm.util.AjaxResult;
import com.dwd.hrm.util.PageList;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: TODO
 * @Author 汶狄
 * @Date 2021/3/8 15:53
 * @Version 1.0
 */
@Component
public class CourseFallbackFactory implements FallbackFactory<CourseDocClient> {
    @Override
    public CourseDocClient create(Throwable throwable) {
        return new CourseDocClient() {
            @Override
            public AjaxResult addOrUpdate(CourseDoc courseDoc) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("上线错误");
            }

            @Override
            public AjaxResult deleteCourse(Long id) {
                return AjaxResult.me().setSuccess(false).setMessage("下线错误");
            }

            @Override
            public AjaxResult addAll(List<CourseDoc> courseDocs) {
                return null;
            }

            @Override
            public PageList<CourseDoc> queryCourses(CourseDocQuery courseDocQuery) {
                return null;
            }

        };
    }
}
